package com.suray.rgv.son.util;

/**
 * 子车状态
 */
public enum RgvSonStatus {
    INVALID(-1, "无效"),
    NOT_READY(0, "非就绪"),
    READY(1, "就绪"),
    ERROR(2, "故障"),
    OFF_LINE(10, "离线"),
    CHARGING(20, "充电中"),
    SPEED_RUN(21, "按速度行驶"),
    WAITING(30, "待命中"),
    ;

    int value;
    String des;

    RgvSonStatus(int value, String des) {
        this.value = value;
        this.des = des;
    }

    public int getValue() {
        return value;
    }

    public static RgvSonStatus parseStatus(int value) {
        for (RgvSonStatus rgvSonStatus : RgvSonStatus.values()) {
            if (rgvSonStatus.value == value) {
                return rgvSonStatus;
            }
        }

        return INVALID;
    }

    @Override
    public String toString() {
        return des;
    }
}
